﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;

namespace App1AppHandler
{
    public class Coins : Loot
    {
        public int NumCoins = 0;

        public Coins(AppHandler2 appHandler) : base (appHandler) 
        {
            this.timerDestroyInterval = 30 * 60 * 1000;
            this.Description = "Double click to split";
        }
        public override string toXML(Character sendingToCharacter)
        {
            string result = "";

            StringWriter stringWriter = new StringWriter();
            XmlTextWriter xmldoc = new XmlTextWriter(stringWriter);

            xmldoc.WriteStartElement("i");
            xmldoc.WriteAttributeString("a", ID.ToString());
            xmldoc.WriteAttributeString("b", GameUID.ToString());
            xmldoc.WriteAttributeString("c", Name.ToString());
            xmldoc.WriteAttributeString("d", ClassName.ToString());
            xmldoc.WriteAttributeString("e", ItemType.ToString());
            xmldoc.WriteAttributeString("f", ImageURL.ToString());
            xmldoc.WriteAttributeString("g", CanConsume.ToString());
            xmldoc.WriteAttributeString("h", Bag.ToString());
            xmldoc.WriteAttributeString("i", Belt.ToString());
            xmldoc.WriteAttributeString("k", Description.ToString());
            xmldoc.WriteAttributeString("l", PriceLow.ToString());
            xmldoc.WriteAttributeString("m", PriceHigh.ToString());

            xmldoc.WriteAttributeString("q", NumCoins.ToString());
            xmldoc.WriteEndElement();
            xmldoc.Flush();

            xmldoc.Close();

            stringWriter.Flush();

            result = stringWriter.ToString();

            return result;
        }
    }
}
